GAPFILE  (by Tawilis)  -  back up what OneDrive doesn't have      Windows and Mac
=================================================================================

WHAT IT DOES
Files saved in OneDrive are safe if your computer crashes. Files saved only on
the computer are not - that's "the gap". GapFile:
  1. scans the WHOLE computer - no folders to choose
     (your user folder, your programs' data, your own folders on C: and on
     other internal disks like D:)
  2. leaves out Windows, installed programs, caches, anything inside OneDrive /
     iCloud / Dropbox / Google Drive, and any file that already has an identical
     copy in OneDrive. "Identical" means the same CONTENT (compared byte by
     byte with SHA-256) - a matching name, size and date alone is not enough.
     OneDrive files that are "online-only" are never downloaded to compare, so
     a PC file whose only match is online-only is backed up anyway.
  3. tells you how much storage the gap needs
  4. COPIES the gap into  OneDrive \ GapFile Backup \ <computer name> \ ...
     Your files stay where they are. Only new and changed files are copied.
New folders you create later are included automatically. Untick anything you
want to leave out (e.g. Videos, if OneDrive space is tight).
Program files are never copied (.exe, .dll, ...: you reinstall programs, you
can't reinstall your files). Folders that hold an installed program (e.g.
C:\ffmpeg) are shown as "Installed program" and left unticked - tick one if it
also keeps data you want. Inside programs' data (AppData), their logs, update
downloads, crash reports and built-in browser caches are left out, so e.g. for
OBS Studio only your scenes and profiles are copied. Installers and disk images
(.iso, .dmg, .msix ...) in Downloads older than 90 days are left out too - you
can download them again. Zips, PDFs and everything else in Downloads are copied.
Click a folder's path in the list to open it and see what's inside.


------------------------------------------------------------------------
A. ON YOUR OWN COMPUTER (installed) - automatic, every hour
------------------------------------------------------------------------
Windows:  double-click GapFile-Setup-1.5.exe (the installer), accept the license.
          GapFile is added to the Start menu and opens.
Mac:      open GapFile-1.5.dmg, drag GapFile onto Applications, open it.
(Before the installer is built you can also use "Open GapFile (Windows).bat" /
 "Open GapFile (Mac).command".)
1. Accept the license, then wait for the scan - it shows the gap and the
   storage needed.
2. Leave "Copy the gap to OneDrive automatically every hour" ticked, click Save.
3. Click "Back up the gap now" for the first copy.
From then on it runs by itself: a few minutes after you log in and then every
hour, copying only new and changed files. It stays quiet when all is well -
you get one notice after the first backup, and a warning when something is
wrong (see WARNINGS below). No thumb drive needed.
Big files that keep changing (over 300 MB, e.g. an Outlook mailbox) are
re-copied at most once a day so OneDrive isn't uploading them every hour.

Coming from GapSync (GapFile's earlier name) or "Tawilis Backup"? Install GapFile
and open it: it takes over your settings, renames "OneDrive\GapSync Backup" to
"GapFile Backup" (nothing is copied twice), and replaces the old startup entry.
You accept the license once more. Then delete the old GapSync files.


------------------------------------------------------------------------
B. ON A COMPUTER WITHOUT GAPFILE - run it from a thumb drive
------------------------------------------------------------------------
1. Copy GapFile.exe (Windows) / GapFile.app (Mac) onto a thumb drive
   (make it with "Build Windows exe.bat" / "Build Mac app.command").
2. Plug the drive into the other computer and double-click GapFile on the drive.
   (Windows doesn't allow programs to start by themselves from a USB drive.)
3. It scans that computer and copies its gap into THAT computer's OneDrive.
   If that computer has no OneDrive, it copies the gap onto the thumb drive:
      <thumb drive> \ GapFile Backup \ <computer name> \ ...
Nothing is installed on that computer; GapFile's settings stay on the drive.


------------------------------------------------------------------------
MAKING THE APP AND THE INSTALLER (no Python needed on users' computers)
------------------------------------------------------------------------
Windows:  double-click "Build Windows installer.bat"
            -> installer\GapFile-Setup-1.5.exe   (publish this one)
            -> dist\GapFile.exe                  (for the thumb drive)
          Needs Inno Setup 6 (free): https://jrsoftware.org/isdl.php or
          "winget install JRSoftware.InnoSetup". The script tells you if it's missing.
          "Build Windows exe.bat" alone makes only dist\GapFile.exe.
Mac:      right-click "Build Mac app.command" > Open
            -> installer/GapFile-1.5.dmg   (publish this one)
            -> dist/GapFile.app            (for the thumb drive)
Build the Windows files on a Windows PC and the Mac files on a Mac.
The Windows installer: installs for the current user (no admin password), adds
a Start menu entry and an entry in Settings > Apps > Installed apps. Installing
a newer version over it keeps the settings and restarts the background copy.
Unsigned apps show a warning the first time ("Windows protected your PC" >
More info > Run anyway; Mac: right-click > Open).


------------------------------------------------------------------------
HOW GAPFILE KNOWS A FILE CHANGED
------------------------------------------------------------------------
A file is copied again when its size or modified date changed, or when the
file system's "change time" shows it was written since the last backup (this
catches programs that edit a file but put the old date back). Once a week the
content of locally available backed-up files is also compared, as a safety net.
When a reliable change time isn't available, content is checked on every backup.
An online-only backup without a verified change-time record is copied again
from the local original, without downloading the old backup to compare it.
A copy that
fails or is postponed is retried until it succeeds. Files that couldn't be
copied (e.g. open in another program) don't count as backed up: if they keep
failing for 3 days you get a warning naming them. Folders GapFile isn't
allowed to read are listed in LAST BACKUP.txt, count as backup failures, and
prevent that run from resetting the last fully successful backup time.
If a file changes while it is being copied, that copy is rejected and retried
on a later backup. The previous backup stays in place. For active databases
and similar files, close the program or use its own backup/export feature.

------------------------------------------------------------------------
GOOD TO KNOW
------------------------------------------------------------------------
- STORAGE: the first copy needs as much OneDrive space as the gap (shown in the
  window). Free OneDrive = 5 GB, Microsoft 365 = 1 TB. The copy also uses space
  on the computer's disk (OneDrive keeps a local copy unless you choose
  "Free up space"). GapFile always leaves 5 GB free and tells you if it can't
  copy more. The most important files (program data, Documents, Desktop) are
  copied first, Videos/Music last.
- Don't work on the files inside "GapFile Backup" - it's a copy. Keep using
  your original files; GapFile updates the copy.
- To restore after a crash: copy files from OneDrive\GapFile Backup\<computer>
  back to the same place (the folder layout mirrors the computer), or use
  "Find an earlier copy" (below) for single files.
- Files open in another program may be skipped that time; they're copied next time.
- "LAST BACKUP.txt" inside GapFile Backup\<computer> lists what was copied.
- Earlier versions: when a file changes, the previous backup copy goes to
  "_old versions" (OneDrive: files up to 200 MB, kept 30 days; thumb drive:
  kept 60 days). OneDrive also keeps its own version history.
- Turn off the automatic copy: untick the box and click Save.
- Uninstall: Windows - Settings > Apps > Installed apps > GapFile > Uninstall
  (or "Uninstall" at the top of the GapFile window). Mac - "Uninstall" at the
  top of the window, then drag GapFile to the Bin. Your backup in OneDrive is
  NOT deleted; delete the "GapFile Backup" folder yourself if you don't want it.
- Settings and log:  Windows %LOCALAPPDATA%\GapFile
                     Mac ~/Library/Application Support/GapFile
                     Thumb drive mode: <drive>\GapFile data\<computer>

------------------------------------------------------------------------
LICENSE
------------------------------------------------------------------------
GapFile is licensed, not open source - free (S$0) for now, sellable later:
- EULA.txt is the agreement users accept the first time GapFile opens.
  GapFile won't scan, copy or run in the background until it's accepted.
  The "License" link at the top of the window shows it again anytime.
- LICENSE.txt is the short summary; THIRD-PARTY-NOTICES.txt (and
  PYTHON-LICENSE.txt, added when you build) cover the parts GapFile is built on.
- Keep these files next to GapFile.exe / GapFile.app when you publish it.
- Publish the download only on www.tawilis.com (or store pages linked from it),
  and put the EULA (or a link to it) on the download page as well.

------------------------------------------------------------------------
LICENSE KEYS (for Tawilis - switching on activation)
------------------------------------------------------------------------
Right now GapFile asks for NO key. It starts asking once you build it with
these two files placed next to gapfile.py (the build scripts do the rest):
  license_public_key.pem  the PUBLIC key from your Tawilis License Manager
                          (starts with -----BEGIN PUBLIC KEY-----).
                          NEVER the private key - the build refuses it.
  license_config.json     {"server_url": "https://<your activation worker>",
                           "get_key_url": "https://www.tawilis.com/<GapFile page>"}
Then, on the server side:
  1. Add product TAWILIS-GAPFILE (key prefix e.g. GF) to the License Manager,
     the worker's product list and the D1 products table.
  2. Make the worker's /activate accept keys issued by your tawilis.com
     checkout (it receives {product_code, license_key, machine_id_hash} and must
     answer {"token": "TAW3...."} signed with your private key, product
     "TAWILIS-GAPFILE"; on a refusal answer {"error": "message for the user"}).
  3. List GapFile on tawilis.com at S$0 - the checkout issues and emails a key.
How it behaves: one key = one computer; activation needs internet once, then
works offline; the full key and the computer's ID are never stored or sent -
only a SHA-256 code of the computer ID. Thumb-drive mode needs no key. To move a
customer to a new PC, free their key in the License Manager.
Test before going live: your own S$0 order -> key email -> activate GapFile ->
"License: active" at the top of the window. Test card payments separately with
a hidden S$1 product bought with your own card, then refund it.

------------------------------------------------------------------------
TIDY-UP REPORT  (button "Tidy-up report" in the window)
------------------------------------------------------------------------
Lists files you may not need - nothing is deleted unless YOU tick it:
  - Exact duplicates (identical content saved in more than one place)
  - Files that already have an identical copy in OneDrive
  - Old installers and .zip archives in Downloads (older than 90 days)
  - Large files (over 100 MB) not changed for a year
  - Old temporary files (Windows temp folder, older than 7 days)
Double-click a file to open its folder and check it.
Is it safe? The report says so for each list (click a list heading for details):
  - Exact duplicates: safe - one copy of each file always stays.
  - Already in OneDrive: safe once OneDrive shows the files as synced.
  - Old installers and archives: your ONLY copy - check zips before ticking.
  - Large files not changed for a year: your ONLY copy - check each one
    ("Tick whole list" is switched off for this list).
  - Old temporary files: safe.
The warning before anything is moved says how many ticked files are your only copy.
"Tick extra copies of duplicates" ticks all copies except one (it keeps the
copy in Documents first, then other folders, then Desktop, then Downloads).
"Move ticked files to the Recycle Bin" asks you to confirm first. Files go to
the Recycle Bin (Mac: Trash) - restore them from there if you change your mind.
The space is freed when you empty the Recycle Bin.
Right before each file is moved, GapFile checks again that the copy that stays
(or the OneDrive copy) still exists, has the same content and is a different
file, and that the ticked file hasn't changed since the report; if not, that
file is left alone. Safety rules: never every copy of a duplicate; never anything in OneDrive,
the GapFile Backup folder, Windows, programs or programs' data; never program
parts (.exe, .dll, .pyd, files in _internal / site-packages ...) - two apps can
contain the same file, but each app needs its own copy to run.
A list of everything moved is kept in "Tidy-up log.txt" (next to the log).
On Windows, "Windows storage settings" opens Storage Sense for system caches.

------------------------------------------------------------------------
FIND A FILE  (button "Find a file..." in the window)
------------------------------------------------------------------------
Type part of a file name (several words must all match, or a pattern such as
*.pdf). GapFile searches OneDrive and your folders on this computer together
and shows, for each file, where it is and whether it is protected:
  Safe in OneDrive / Same file is also in OneDrive / Backed up by GapFile, or
  Not backed up - only on this PC (in red).
Double-click a result to open the file; "Show in folder" opens its location;
"Copy location" copies the full path. Online-only OneDrive files are found
without downloading them.

------------------------------------------------------------------------
FIND AN EARLIER COPY  (button "Find an earlier copy..." in the window)
------------------------------------------------------------------------
Deleted a file by mistake, or saved over it? Type part of its name (or click
"Pick the file...") and GapFile lists every copy it has: the latest backup
copy and earlier versions, in OneDrive and on any plugged-in thumb drive with a
GapFile Backup. Pick one and click "Restore this copy". It is saved as a NEW
file next to the original, e.g. "Budget (restored 2026-10-09).xlsx" - nothing
is ever overwritten. Limits: an earlier version exists only if a backup ran
between your changes (hourly), and only for as long as it is kept. Files that
were saved inside OneDrive are not in GapFile's backup - use OneDrive's own
Version history / Recycle bin for those. Just deleted it? Check the Recycle Bin
first.

------------------------------------------------------------------------
WARNINGS  (so a broken backup doesn't go unnoticed)
------------------------------------------------------------------------
GapFile shows a Windows / Mac notification when:
  - no backup has succeeded for 3 days
  - some files couldn't be copied (e.g. open in another program)
  - OneDrive is full or the computer's disk is too full
  - the OneDrive app isn't running (files would sit on the PC, not uploaded)
  - the OneDrive folder is missing (signed out)
  - the backup crashed unexpectedly
  - the license terms changed and automatic backup is paused
Each warning is shown at most once a day. The window shows the same status
under "Last backup" (red when something is wrong).
What it can't do: warn you if GapFile itself isn't running (removed, blocked,
or the computer never starts), or confirm OneDrive actually finished
uploading - check OneDrive's cloud icon in the taskbar now and then.
